<template>
  <div id="errorDialog">
    <el-dialog title="系统提示" :visible.sync="dialogData.isShow" width="450px">
      <!-- 添加文件部分 -->
      <div class="content">
        <i class="el-icon-warning-outline warning"></i>
        <p v-html="dialogData.warningText"></p>
      </div>
      <el-button
        v-if="from"
        type="info"
        class="download_btn fa fa-file-excel-o"
        :loading="loading"
        @click="downloadData"
      >
        下载失败数据
      </el-button>
      <span slot="footer" class="dialog-footer">
        <el-button type="success" @click="cancelLabel">确认</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  props: {
    dialogData: {
      type: Object,
      default: function() {
        return {
          isShow: false, // 显示隐藏
          warningText: '' // 报错提示语
        }
      }
    },
    from: {
      //from："shareWord" -分享语管理 ,"popUpDanger"-直播间弹幕严禁词 , "hotFailed"关注热门推荐管理
      type: String,
      default: function() {
        return ''
      }
    },
    params: {
      type: String,
      default: function() {
        return ''
      }
    }
  },  
  data() {
    return {
      loading: false,
      curReqUrl: {
        physicalOrder:'/marketing/prize-orders/export/error',
        downUserIssue:'/giving-courses/export/dp-account/error',//赠课活动 新增活动 用户发放失败数据
        downErrorData: '/orders/extended-services/users/export/error', // 服务期延长，导入失败
        shareWord: '/terminologies/share/export/error', // 分享语管理
        userDangerWords: '/keywords/user-sensitive/export/error', // 用户名严禁词
        popUpDanger: '/keywords/barrage-sensitive/export/error', // 直播间弹幕严禁词
        contentDangerWords: '/keywords/comment-danger/export/error', // 内容/评论/回复高危词
        contentProhibitWords: '/keywords/comment-sensitive/export/error', // 内容/评论/回复严禁词
        hotFailed: '/recommends/export/error', // 关注热门推荐管理
        commitWord: '/terminologies/comments/export/error', // 评论库管理
        tagCategory: '/tag-categories/export-error-info', // 标签分类管理
        vestWord: '/robots/export/error', // 马甲管理
        batchWord: '/robots/export/error-update', // 马甲管理-批量导入失败
        tagManageDp: '/tags/dpAccount/export-error-info', //标签管理，导出失败的大鹏号
        tagManage: '/tags/export-error-info', //标签管理，导出失败的标签
        userRule: '/users/export/dp-account/error', //官方征集自评活动-预设用户规则-创建标签
        mobile:'/coupons/download/mobile',//人工类型优惠券错误数据下载
        prizeSetting: '/activities/prize/export/dp-account/error', //官方征集自评活动-奖品配置
        allocatedManage: '/prizes/export/error', //官方征集自评活动-发放管理
        videoBatch: '/works/videos-material/export/error', //小视频批量管理
        longVideoBatch: '/movie-material/export/error', //长视频批量管理
        autoCommitWord: '/auto-comments/export/error', // 自动评论库管理
        readPower: '/reads/permissions/export/error', // 阅读管理-权限管理
        circleMember: '/circles/export/error', // 圈子管理-圈子成员
        userInfo: '/backflow/internal-user/export/error',
        freezeBatch: '/integrals/export/error-freeze-integral', //批量冻结积分
        integralsBatchEdit: '/integrals/export/error-change-integral' //批量修改积分
      }
    }
  },
  methods: {
    cancelLabel() {
      // 关闭前清空
      this.loading = false
      this.dialogData.isShow = false
      this.dialogData.warningText = ''
    },
    /* 下载失败数据 */
    downloadData() {
      this.loading = true
      let url = this.curReqUrl[this.from]
      var _this = this
      if (this.params == 'user') {
        _this.downFileApplet('get', url, '', '失败数据')
      } else {
        _this.downFile('get', url, '', '失败数据')
      }

      this.loading = false
    }
  }
}
</script>
<style lang="less">
#errorDialog {
  .el-dialog__body {
    padding-bottom: 10px !important;
    .content {
      overflow: auto;
      max-height: 600px;
      padding-bottom: 10px;
    }
    i.warning {
      margin-right: 5px;
      font-size: 16px;
      float: left;
      line-height: 22px;
    }
    p {
      width: 91%;
      line-height: 22px;
      float: left;
    }
  }
}
</style>
